<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="master.html" />

<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
    <meta name="robots" content="noindex,follow" />
    <title>Archives - <span py:replace="blog.name">Ponies!!1!one!</span> - <span py:replace="blog.owner.display_name">Sara Swift</span></title>

</head>

<body id="archives">

            <py:if test="not defined('tagname')">
                <h1>Archives</h1>
            </py:if>

            <py:if test="not defined('tagname')">
                <p>
                    <a href="${tg.url_for('frontpage')}">${blog.name}</a> <py:if test="not past">has</py:if> had
                    <py:choose test="">
                        <py:when test="numposts == 0">no posts</py:when>
                        <py:when test="numposts == 1">one post</py:when>
                        <py:when test="numposts > 1">${numposts} posts</py:when>
                    </py:choose>
                    <py:choose test="">
                        <py:when test="not defined('year')">over ${time_since}.</py:when>
                        <py:when test="defined('day') and day">on this day.</py:when>
                        <py:when test="defined('month') and month">in this month.</py:when>
                        <py:when test="defined('year') and year">in this year.</py:when>
                    </py:choose>
                    <py:if test="defined('posts_per_week') and posts_per_week">This is a rate of ${posts_per_week} posts per week.</py:if>
                </p>
                <p py:if="firstpost">The first post, <a href="${tg.url_for('posts',post=firstpost)}">${firstpost.title}</a>, was written on <a href="#p${firstpost.post_id}">${firstpost.creation_time.strftime('%e %B %Y')}</a>.</p>

                <p py:if="other_posts_this_year">You might also be interested in
                    <py:if test="other_posts_this_month"><a href="${tg.url_for('archives')}#d${year}${month}">other posts this month</a> or</py:if>
                    <a href="${tg.url_for('archives')}#d${year}">other posts this year</a>.
                </p>

                <p>You can also <a href="${tg.url_for('taglist')}">browse posts by tag</a>.</p>
            </py:if>

            <py:if test="defined('tagname')">
                <h1>${tagname}</h1>
                <p><a href="${tg.url_for('frontpage')}">${blog.name}</a> has ${numposts} posts <a href="${tg.url_for('taglist')}">tagged</a> with ${tagname}.</p>
                <p>The first post with this tag, <a href="${tg.url_for('posts',post=firstpost)}">${firstpost.title}</a>, was written on <a href="#p${firstpost.post_id}">${firstpost.creation_time.strftime('%e %B %Y')}</a>.</p>

                <p>You can also browse all posts chronologically in the <a href="${tg.url_for('archives')}">archives</a>.</p>
            </py:if>

            <div py:if="not defined('year') and len(posts) > 1" style="text-align: center;">
                <span py:strip="True" py:for="i, (year, posts_by_month) in enumerate(posts)">
                <span py:strip="True" py:if="i"> | </span>
                <a href="#d${year.year}">${year.year}</a>
                </span>
            </div>

            <table id="archives_table" width="100%">
            <div py:strip="True" py:for="year, posts_by_month in posts">
            <tr class="year">
                <th colspan="2" id="d${year.year}">
                    <span class="num_posts_in_year">${sum(len(posts_in_month) for month, posts_in_month in posts_by_month)} posts in</span> ${year.year} <a py:if="not year" href="#main">^</a><br />
                    <span class="months_in_year" py:if="not defined('month')">
                    <span py:strip="True" py:for="i, (month, posts_in_month) in enumerate(sorted(posts_by_month))">
                        <span py:strip="True" py:if="i"> | </span>
                        <a href="#d${month.strftime('%Y%m')}">${month.strftime('%B')}</a>
                    </span>
                    </span>
                </th>
            </tr>
            <div py:strip="True" py:for="month, posts_in_month in posts_by_month">
            <tr class="month"><th id="d${month.strftime('%Y%m')}">${month.strftime('%B')}</th><td class="num_posts_in_month">${len(posts_in_month)} posts:</td></tr>
            <div py:strip="True" py:for="post in posts_in_month">
            <tr><th>${post.creation_time.day}</th><td id="p${post.post_id}"><a href="${tg.url_for('posts', post=post)}">${post.title}</a></td></tr>
            </div>
            </div>
            </div>
            </table>
</body>
</html>
